package com.zmsoft.boxy.sfg.api;

import javax.annotation.Resource;

import org.cnsoft.framework.beans.common.RESTResultBean;
import org.cnsoft.framework.beans.user.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cnsoft.material.IMaterialConstants;
import com.zmsoft.boxy.sfg.MySFGControllerSupport;
import com.zmsoft.boxy.sfg.player.BoxySFGPlayer;
import com.zmsoft.boxy.sfg.service.SFGGameActionService;

/**
 * 玩家游戏操作接口
 * 
 * @version 1.0.0 2014/11/19
 * @since 1.0.0 2014/11/19
 */
@Controller
//@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
@RequestMapping(value = "/game/1.0/sfg/action")
public class SFGGameActionApiController extends MySFGControllerSupport implements IMaterialConstants {

	@Resource
	private SFGGameActionService mySFGGameActionService;

	/**
	 * 开垦
	 */
	@RequestMapping(value = "/bring.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameBring(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doLandReclamation(player.init());
	}
	
	/**
	 * 种植
	 */
	@RequestMapping(value = "/sow.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameSow(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doLandPlant(player.init());
	}
	
	
	/**
	 * 浇水
	 */
	@RequestMapping(value = "/watering.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameWatering(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doLandPlant(player.init());
	}
	

	
	/**
	 * 施肥
	 */
	@RequestMapping(value = "/fertilize.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameFertilize(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doLandPlant(player.init());
	}
	
	/**
	 * 除草
	 */
	@RequestMapping(value = "/weed.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameWeed(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doLandPlant(player.init());
	}
	
	/**
	 * 杀虫
	 */
	@RequestMapping(value = "/insecticidal.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameInsecticidal(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doLandPlant(player.init());
	}
	
	/**
	 * 收割果实/农场升级信息
	 */
	@RequestMapping(value = "/harvest.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameHarvest(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doFarmPick(player.init());
	}

	/**
	 * 翻地
	 */
	@RequestMapping(value = "/turn.js", method =  {RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public RESTResultBean<UserBean> doGameTurn(BoxySFGPlayer player) throws Exception {
		return mySFGGameActionService.doShopBuy(player.init());
	}

}
